#include "player.h"
#include <cstdlib>
#include <cstring>
#include "misc.h"

#include "log.h"

Player::Player() : score(0), id(0), nick("") {
};

void Player::parse_proto(char *p, int strln) {
	int pos, i;
	char *n;
	*lg<<"Player::p_p: "<<p[0]<<fl;
	if (p[0] == 'N') {
		*lg<<"Player::p_p: N"<<fl;
		p++;
    i = extract_int(p, pos);
        p+= pos; *lg<<"Player::p_p: i="<<i<<fl;
		n = extract_str(p, i, pos);
		set_nick(string(n));
		delete[] n;
	};
};

void Player::set_score(int s) {
	score = s;
};

int Player::get_score(void) {
	return score;
};

void Player::set_nick(string s) {
	nick = s;
};

string Player::get_nick(void) {
	return nick;
};

void Player::set_id(int i) {
	id = i;
};

int Player::get_id(void) {
	return id;
};

